<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function add1(){
				let text=document.createElement("p")
				// 创建p节点
				text.innerHTML="文字节点"
				text.setAttribute("style","color:red")//通过改变style属性来间接控制css样式
				document.getElementsByClassName("con")[0].appendChild(text)
			}
			function add2(){
				let img=document.createElement("img")
				// 创建p节点
				img.setAttribute("src","../src/ok.png")
				document.getElementsByClassName("con")[0].appendChild(img)
			}
		</script>
	</head>
	<body>
		<button type="button" onclick="add1()">添加文本</button>
		<button type="button" onclick="add2()">添加图片</button>
		<div class="con"></div>
	</body>
</html>
